<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .box{
      width:200px;
      height:200px;
      background: red;
    }
  </style>
</head>
<body>
  <div id="app">
    <button>消失</button>
    <div class="box"></div>
  </div>
 <script>
   var btn = document.querySelector("button");
   var box = document.querySelector('.box');
   btn.onclick = function(){
     if(!this.isShow){
      box.style.display="none";
      this.innerHTML = "显示";
      this.isShow = !this.isShow;
     }else{
      box.style.display="block";
      this.innerHTML = "消失";
      this.isShow = !this.isShow;
     }
   }
 </script>
</body>
</html>